<template>
  <l-layout class="l-tab-page">
    <l-select-panel
      style="padding: 8px"
      ref="selectPanel"
      valueKey="f_Id"
      :multiple="true"
      :columns="columns"
      :isPage="true"
      :loadSelectTable="loadSelectTable"
      isSaveSelectData
    >
      <template v-slot:f_IsUrge="scope">
        <el-tag v-if="scope.row.f_IsUrge == 1" size="mini" type="warning"
          >{{$t('催办')}}</el-tag
        >
        <el-tag v-else size="mini" type="success">{{ $t('正常') }}</el-tag>
      </template>
      <template v-slot:f_CreateDate="scope">
        {{ lr_dateFormat(scope.row.f_CreateDate) }}
      </template>
    </l-select-panel>
  </l-layout>
</template>
<script>
const api = window.$api.workflow.process;
export default {
  props: {},
  data() {
    return {
      columns: [
        { label: "任务", prop: "f_UnitName", minWidth: 100, align: "left" },
        { label: "标题", prop: "f_ProcessTitle", minWidth: 100, align: "left" },
        { label: "状态", prop: "f_IsUrge", width: 60, align: "center" },
        {
          label: "提交人",
          prop: "f_ProcessUserName",
          width: 100,
          align: "left",
        },
        { label: "时间", prop: "f_CreateDate", width: 160, align: "left" },
      ],
    };
  },
  created() {},
  mounted() {},
  computed: {},
  methods: {
    refreshData() {
      this.$refs.selectPanel.init();
    },
    async loadSelectTable(postData) {
      postData.sidx = "f_IsUrge DESC,t.F_CreateDate DESC";
      const res = await this.$awaitWraper(
        api.getUnCompletedBatchPage(postData)
      );
      return res;
    },
    reset() {
      this.$refs.selectPanel.reset();
      this.$refs.selectPanel.init();
    },
    async get(){
      let select =  await this.$refs.selectPanel.getSelected(false);
      return select
    }
  },
};
</script>